package vn.wallet.app.domain;

// Generated Nov 15, 2012 12:09:27 PM by Hibernate Tools 3.4.0.CR1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/**
 * Budget generated by hbm2java
 */
@Entity
@Table(name = "budget", catalog = "wallet")
public class Budget implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer id;
	private User user;
	private Scheduler scheduler;
	private String name;
	private String description;
	private float projected;
	private float actual;
	private boolean status;
	private Date createdOn;
	private Date lastModified;
	private Set<Payment> payments = new HashSet<Payment>(0);

	public Budget() {
	}

	public Budget(User user) {
		this.user = user;
	}

	public Budget(User user, float projected, float actual, boolean status,
			Date createdOn) {
		this.user = user;
		this.projected = projected;
		this.actual = actual;
		this.status = status;
		this.createdOn = createdOn;
	}

	public Budget(User user, Scheduler scheduler, String name,
			String description, float projected, float actual, boolean status,
			Date createdOn, Date lastModified, Set<Payment> payments) {
		this.user = user;
		this.scheduler = scheduler;
		this.name = name;
		this.description = description;
		this.projected = projected;
		this.actual = actual;
		this.status = status;
		this.createdOn = createdOn;
		this.lastModified = lastModified;
		this.payments = payments;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "scheduler_id")
	@Cascade({ CascadeType.SAVE_UPDATE })
	public Scheduler getScheduler() {
		return this.scheduler;
	}

	public void setScheduler(Scheduler scheduler) {
		this.scheduler = scheduler;
	}

	@Column(name = "name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "description", length = 65535)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "projected", nullable = false, precision = 12, scale = 0)
	public float getProjected() {
		return this.projected;
	}

	public void setProjected(float projected) {
		this.projected = projected;
	}

	@Column(name = "actual", nullable = false, precision = 12, scale = 0)
	public float getActual() {
		return this.actual;
	}

	public void setActual(float actual) {
		this.actual = actual;
	}

	@Column(name = "status", nullable = false)
	public boolean isStatus() {
		return this.status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "created_on", nullable = false, length = 19)
	public Date getCreatedOn() {
		return this.createdOn;
	}

	public void setCreatedOn(Date createdOn) {
		this.createdOn = createdOn;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_modified", length = 19)
	public Date getLastModified() {
		return this.lastModified;
	}

	public void setLastModified(Date lastModified) {
		this.lastModified = lastModified;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "budget")
	public Set<Payment> getPayments() {
		return this.payments;
	}

	public void setPayments(Set<Payment> payments) {
		this.payments = payments;
	}

}
